Repository navigation
Document a pre-commit hook that commits the graph with the code that changed it - #39
Conversation
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Adds a "Commit the graph with the code that changed it" section to the team workflows guide, with a committed .githooks/pre-commit script that rebuilds graph.json and stages it, so each commit carries the graph of its own code instead of leaving the post-commit rebuild as a dirty change. Setup tracks only graphify-out/graph.json through a narrowed .gitignore, marks it generated in .gitattributes, and registers the graphify union merge driver by hand, since that driver is only installed by graphify hook install. The hook fails the commit if the rebuild fails or graphify is missing, and GRAPHIFY_SKIP_HOOK=1 or --no-verify skips it at the cost of a stale graph. The partial-commit recipe built on git stash --keep-index --include-untracked is the part most likely to leave a reader's working tree in a bad state, because it never says how to restore the stash afterward.
No blocking issues surfaced. 2 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 6 functions depend on the 6 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 6 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 6 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
0 test file(s) selected via static blast radius.
Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.
non-code file(s) changed (
guides/team-workflows.mdx) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
guides/team-workflows.mdx) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
6b7fcfa to
69e84ee
Compare
|
Helpful section, and the commands exist. Two things in the snippet will surprise people who already use
One sentence worth adding: this replaces both hooks Checked against the package: |
69e84ee to
ff12bbf
Compare
✅ Preview approved@SyedFahad7 approved a Mintlify preview for commit |
|
Thanks, all three are in (ff12bbf, rebased on current
|
|
@SyedFahad7 could you take another look? All three points are addressed in ff12bbf (details in my previous comment), and CI is green. The Mintlify preview still needs a maintainer to approve it, since the PR comes from a fork. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
SyedFahad7
left a comment
There was a problem hiding this comment.
Looks good. Your three fixes are in (PYTHONHASHSEED pin, pinned merge-driver Python, and which hooks this replaces). Preview builds cleanly on the team-workflows page.
This sits next to our Cloud move guide without conflict: yours is the local path for teams that commit graph.json; ours is for people switching assistants to the hosted MCP.
|
Quick note on the Guides sidebar (not from your change — this is existing Mintlify currently has a Team group with We're flattening that nav in a follow-up so both pages show as peers under Guides (no root hiding the team-workflows title). Your pre-commit section content is fine as approved. |
What this adds
A new section in Share context with your team (
guides/team-workflows.mdx), plus a pointer from step 4 of the repository workflow. It describes another way for teams to keep a committedgraphify-out/graph.jsoncurrent.graphify hook installrebuilds the graph after each commit, in the background. When a team commitsgraph.json, each commit therefore leaves the rebuilt graph behind as an uncommitted change, and someone has to commit it separately. The alternative is a shortpre-commithook that rebuilds the graph before the commit and stages it. Each commit then carries the graph of its own code. The section covers:graph.json(graphify-out/*+!graphify-out/graph.json), and how to move an existing setup that tracks all ofgraphify-out/;.gitattributes:merge=graphify linguist-generated=true -diff, with what each attribute does;graph.jsonwritten since 0.9.86 (fix: write graph.json as one line of compact JSON (#3413) graphify#4319), which GitHub counts as +1 −1 per rebuild;hook install, and how to recover a clone that skipped it;pre-commitfile in git's hooks directory (wheregraphify hook installputs its post-commit hook) or to a hook manager's pre-commit step, without disabling other checks; and, as an option, committing it in.githooks/withcore.hooksPathto share it;pre-commit(merges it completes,rebase,cherry-pick,revert), matching graphify releases, and commit latency.Where it comes from
pfBlockerNG/pfBlockerNG runs this setup: a pre-commit hook rebuilds and stages
graph.json, and the same.gitattributesline applies. Its recent merged PRs showgraphify-out/graph.jsonas +1 −1 on GitHub.Verification
I ran every snippet on the page verbatim in scratch repositories, with git 2.47.3 and graphify 0.9.92:
graph.jsonand leaves a clean tree. A commit that stages only the graph does not rebuild it.GRAPHIFY_SKIP_HOOK=1skips the rebuild. WithoutgraphifyonPATH, the commit fails.git merge --no-commitfollowed bygit commitproduces a graph identical to a freshgraphify update .. A merge that git completes without conflicts runs nopre-commit, and neither does a rebase. Apre-merge-commithook'sgit adddoes not reach the merge commit either, so the page doesn't suggest one.graph.json. The documentedrm … && graphify update . && git add …recovery commits a fresh graph.graphify update .took 49–58 s on a 2,832-file repository.An independent review re-ran the snippets and also probed the stash,
git commit <path>,cherry-pick/revert, patch, existing-hook (set -eu, finalexit) and no-graph-repo cases. The page reflects its corrections.